-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Issue-125323: ICE non-ADT in struct pattern when long time constant evaluation is in for loop #138679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
This PR changes a file inside |
I don't believe this is the right solution, because using The real root cause of this issue is this: rust/compiler/rustc_interface/src/passes.rs Lines 991 to 995 in 75530e9
...which causes us to enter r? oli-obk |
Please ensure that after this PR is fully reworked that it's squashed into a single commit. |
Yea errs' analysis is spot on. Skipping the |
Thanks both! @oli-obk
Are you talking about ResultsVisitor in compiler/rustc_mir_dataflow/src/framework/visitor.rs? So far I don't understand how to record the error into the query result. It would be great if you give me a hint which code I should looking for |
Does this fix #138361 as well? Seems like a very closely related issue, at the very least. Ideally we'd make sure that the approach taken will take care of both of these. |
@meithecatte I think the root cause is the same. I tried your issue's failure case with 3cf7d22, and the ICE didn't happen, although as we discussed above I can't use this commit as the solution. @oli-obk @compiler-errors |
I tried this before, it is very complex and fragile and comes with a runtime cost. So that's not a solution that can be applied here.
you can change the query result in the query declaration to |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@oli-obk I spent too much time, but finally I could have some progresses.
|
@rustbot review |
Unrelated to review, but please make sure to clean up the commit history and make sure this approach is explained clearly why is it both necessary and sufficient for fixing the ICE. |
25f6d69
to
2e576ab
Compare
☔ The latest upstream changes (presumably #145186) made this pull request unmergeable. Please resolve the merge conflicts. |
7ca34e4
to
845ff73
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
@rustbot review |
@bors try @rust-timer queue Will merge after perf is clean (should be, but wanna make sure rolling this PR up is fine) |
This comment has been minimized.
This comment has been minimized.
Issue-125323: ICE non-ADT in struct pattern when long time constant evaluation is in for loop
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (f20a1c6): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary 1.9%, secondary 2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 473.727s -> 474.422s (0.15%) |
@bors r+ rollup |
Issue-125323: ICE non-ADT in struct pattern when long time constant evaluation is in for loop This PR fixes rust-lang#125323 ## Context According to the issue, the ICE happens since rust-lang#121206. In the PR, some error methods were reorganized. For example, has_errors() was renamed to has_errors_exclude_lint_errors(). However, some codes which used the original has_errors() were not switched to has_errors_exclude_lint_errors(). I finally found that report_error() in writeback.rs causes this ICE. Currently the method uses tainted_by_errors() to get guar (ErrorGuaranteed), but originally it used dcx().has_errors() but it wasn't changed to has_errors_exclude_lint_errors() when changes in rust-lang#121206 were merged. I don't think I fully understand how an error is propagated, but I suppose that the error from long time constant evaluation is unexpectedly propagated other parts (in this ICE, for loop), then cause the non-ADT in struct pattern ICE. ## Change - Fix report_error() in writeback.rs: use dcx().has_errors_exclude_lint_errors() instead of tainted_by_errors() to prevent error propagation from constant evaluation. - Add test for the ICE - Modify some tests to align the change: Due to this fix, E0282 error happens (or not happen anymore) in some tests. ## NOTE The 4th commit aims to revert the fix in rust-lang#123516 because I confirmed that the ICE solved by the PR doesn't happen if I modify report_error(). I think the root cause of that ICE is the same as rust-lang#125323 . But I can discard this commit since we can fix rust-lang#125323 without it.
Rollup of 8 pull requests Successful merges: - #138679 (Issue-125323: ICE non-ADT in struct pattern when long time constant evaluation is in for loop) - #146167 (Deny-by-default never type lints) - #146490 (Rehome 26 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#5 of Batch #2]) - #147438 (Rename "non-inline module" to "file module" in proc macro diagnostics) - #147724 (Fix ICE in pattern matching with generic const array length errors) - #147813 (Warn on unused_attributes in uitests ) - #147816 (Do not error out for `download-rustc` if LTO is configured) - #147845 (Add regression test for 134355) r? `@ghost` `@rustbot` modify labels: rollup
Issue-125323: ICE non-ADT in struct pattern when long time constant evaluation is in for loop This PR fixes rust-lang#125323 ## Context According to the issue, the ICE happens since rust-lang#121206. In the PR, some error methods were reorganized. For example, has_errors() was renamed to has_errors_exclude_lint_errors(). However, some codes which used the original has_errors() were not switched to has_errors_exclude_lint_errors(). I finally found that report_error() in writeback.rs causes this ICE. Currently the method uses tainted_by_errors() to get guar (ErrorGuaranteed), but originally it used dcx().has_errors() but it wasn't changed to has_errors_exclude_lint_errors() when changes in rust-lang#121206 were merged. I don't think I fully understand how an error is propagated, but I suppose that the error from long time constant evaluation is unexpectedly propagated other parts (in this ICE, for loop), then cause the non-ADT in struct pattern ICE. ## Change - Fix report_error() in writeback.rs: use dcx().has_errors_exclude_lint_errors() instead of tainted_by_errors() to prevent error propagation from constant evaluation. - Add test for the ICE - Modify some tests to align the change: Due to this fix, E0282 error happens (or not happen anymore) in some tests. ## NOTE The 4th commit aims to revert the fix in rust-lang#123516 because I confirmed that the ICE solved by the PR doesn't happen if I modify report_error(). I think the root cause of that ICE is the same as rust-lang#125323 . But I can discard this commit since we can fix rust-lang#125323 without it.
Rollup of 7 pull requests Successful merges: - #138679 (Issue-125323: ICE non-ADT in struct pattern when long time constant evaluation is in for loop) - #146490 (Rehome 26 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#5 of Batch #2]) - #147438 (Rename "non-inline module" to "file module" in proc macro diagnostics) - #147724 (Fix ICE in pattern matching with generic const array length errors) - #147813 (Warn on unused_attributes in uitests ) - #147816 (Do not error out for `download-rustc` if LTO is configured) - #147845 (Add regression test for 134355) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #138679 - Shunpoco:issue-125323, r=oli-obk Issue-125323: ICE non-ADT in struct pattern when long time constant evaluation is in for loop This PR fixes #125323 ## Context According to the issue, the ICE happens since #121206. In the PR, some error methods were reorganized. For example, has_errors() was renamed to has_errors_exclude_lint_errors(). However, some codes which used the original has_errors() were not switched to has_errors_exclude_lint_errors(). I finally found that report_error() in writeback.rs causes this ICE. Currently the method uses tainted_by_errors() to get guar (ErrorGuaranteed), but originally it used dcx().has_errors() but it wasn't changed to has_errors_exclude_lint_errors() when changes in #121206 were merged. I don't think I fully understand how an error is propagated, but I suppose that the error from long time constant evaluation is unexpectedly propagated other parts (in this ICE, for loop), then cause the non-ADT in struct pattern ICE. ## Change - Fix report_error() in writeback.rs: use dcx().has_errors_exclude_lint_errors() instead of tainted_by_errors() to prevent error propagation from constant evaluation. - Add test for the ICE - Modify some tests to align the change: Due to this fix, E0282 error happens (or not happen anymore) in some tests. ## NOTE The 4th commit aims to revert the fix in #123516 because I confirmed that the ICE solved by the PR doesn't happen if I modify report_error(). I think the root cause of that ICE is the same as #125323 . But I can discard this commit since we can fix #125323 without it.
This PR fixes #125323
Context
According to the issue, the ICE happens since #121206.
In the PR, some error methods were reorganized. For example, has_errors() was renamed to has_errors_exclude_lint_errors(). However, some codes which used the original has_errors() were not switched to has_errors_exclude_lint_errors(). I finally found that report_error() in writeback.rs causes this ICE. Currently the method uses tainted_by_errors() to get guar (ErrorGuaranteed), but originally it used dcx().has_errors() but it wasn't changed to has_errors_exclude_lint_errors() when changes in #121206 were merged. I don't think I fully understand how an error is propagated, but I suppose that the error from long time constant evaluation is unexpectedly propagated other parts (in this ICE, for loop), then cause the non-ADT in struct pattern ICE.
Change
NOTE
The 4th commit aims to revert the fix in #123516 because I confirmed that the ICE solved by the PR doesn't happen if I modify report_error(). I think the root cause of that ICE is the same as #125323 . But I can discard this commit since we can fix #125323 without it.